window.String.prototype.toFixed = function(n) {
	var num = Number(this);
	return num.toFixed(n);
}

var common = {
	// 开启loading
	loadingBegin: function() {
		var $loading = $('#loading');
		if(!$loading.length) {
			var htmlStr = `
			<div id="loading" class="loading">
			<p>
				<span class="circel">我</span>
				<span class="circel">最</span>
				<span class="circel">帅</span>
			</p>
			<p class="loadingText">努力加载中......</p>
		</div>`;
			$('body').prepend(htmlStr);
		} else {
			$loading.show();
		}
	},
	// 关闭loading
	loadingFinish: function() {
		setTimeout(function() {
			$('#loading').hide();
		}, 300);
	},

	/**
	 * name是你要获取的参数名称 
	 */
	getUrlParam(name) {
		var query = window.location.search.substring(1);
		var vars = query.split("&");
		for(var i = 0; i < vars.length; i++) {
			var pair = vars[i].split("=");
			if(pair[0] == name) {
				return pair[1];
			}
		}
		return(false);
	}
}